 export function download (data, fileName) {
    const link = document.createElement('a')
    // 新标签页中下载文件，避免浏览器直接打开图片、pdf等资源
    link.target = '_blank'
  
    // 处理安全漏洞
    link.ref = 'noopener noreferrer'
  
    link.download = fileName
    link.style.display = 'none'
    link.href = data
  
    document.body.appendChild(link)
    link.click()
  
    // 释放资源
    window.URL.revokeObjectURL(link.href)
    document.body.removeChild(link)
  }
  export function getTreeData(data) {
    for (var i = 0; i < data.length; i++) {
        if ((data[i].children || []).length < 1) {
            data[i].children = undefined;
        } else {
            this.getTreeData(data[i].children);
        }
    }
      return data;
}

 export function getTreeDatabak(data) {
     for (var i = 0; i < data.length; i++) {
         if (data[i].children != null) {
         if ((data[i].children || []).length < 1) {
             data[i].children = undefined;
         } else {
             this.getTreeData(data[i].children);
         }
     }
     }
     console.log("aaa"+JSON.stringify(data))

     return data;
}